package acm.pta3;

import java.util.Scanner;

public class T4 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        for (int i = 0; i < N; i++) {
            int num = scanner.nextInt();
            System.out.println(isPrime2(num) ? "Yes" : "No");
        }
    }

    public static boolean isPrime(int num) {
        if (num <= 1) {
            return false;
        }
        for (int i = 2; i  <= Math.sqrt(num); i++) {
            if (num % i == 0) {
                return false;
            }
        }
        return true;
    }
    public static boolean[] isPrime=new boolean[200];
    public static int curr=2;
    public static boolean isPrime2(int num) {
        if (num <= curr) {
            return !isPrime[num];
        }
        int sqrt = (int) Math.sqrt(num);
        for (int i = (int) Math.sqrt(curr); i <= sqrt; i++) {
            for (int j = 2; i*j <=num ; j++) {
                isPrime[i*j]=true;
            }
        }
        curr=num;
        return !isPrime[num];
    }
}

